//
// Created by Yun on 2025/3/2.
//

#ifndef FRMAEWORK_DEMO_GPIO_DEV_OLED_4P_H
#define FRMAEWORK_DEMO_GPIO_DEV_OLED_4P_H

#include "dev_common_type.h"
#include "i2c_interface.h"

#define OLED_SET_DCDC 0X8D
#define OLED_SET_DCDC_ON 0X14
#define OLED_SET_DCDC_OFF 0X10
#define OLED_DISPLAY_ON 0XAF
#define OLED_DISPLAY_OFF 0XAE



typedef struct Dev_OLed_4p {
    I2c_Interface_TypeDef* pstI2CInterface; /*!< I2C接口 */
    void* pHwCfg;
    uint8_t* pu8InitCmd; /*!< 屏幕初始化命令 */
    uint16_t u16InitCmdLen; /*!< 屏幕初始化命令长度 */
    uint16_t u16DevAddr; /*!< 屏幕设备地址 */
    uint8_t u8CmdMem; /*!< 命令寄存器存储区 */
    uint8_t u8DataMem; /*!< 数据寄存器存储区 */
    uint16_t u16TimeOut; /*!< 屏幕设备地址 */
    uint8_t u8InitState:1;                       /*!< 初始状态 */
    uint8_t u8RunState:1;                            /*!< 运行状态 */
    uint8_t u8LockState:1;                          /*!< 锁定状态 */
}Dev_OLed_4p_Cfg_TypeDef;

uint8_t Dev_OLed_4P_Register(Dev_OLed_4p_Cfg_TypeDef* pstDevOLed4PCfg,
                             void* pHwCfg,
                             I2c_Interface_TypeDef* pstI2CInterface);

uint8_t Dev_OLed_4P_Display_En(Dev_OLed_4p_Cfg_TypeDef* pstDevOLed4PCfg,
                               uint8_t u8Enable);

uint8_t Dev_OLed_4P_Clear(Dev_OLed_4p_Cfg_TypeDef* pstDevOLed4PCfg);


uint8_t Dev_OLed_4P_Show(Dev_OLed_4p_Cfg_TypeDef* pstDevOLed4PCfg,
                         uint8_t u8PosX,
                         uint8_t u8PosY,
                         uint8_t* pu8Data,
                         uint16_t u16Width,
                         uint16_t u16Height);
uint8_t Dev_OLed_4P_Show_ALL(Dev_OLed_4p_Cfg_TypeDef* pstDevOLed4PCfg);

#endif //FRMAEWORK_DEMO_GPIO_DEV_OLED_4P_H
